/**
 * Created by Adi(adi@imeth.cn) on 2016/11/1.
 */
import React from 'react';
import{
	View,
	Text,
	StyleSheet,
} from 'react-native';

import {connect} from 'react-redux';
import * as Actions from '../action/CountAction';

class Main extends React.Component {

	static propTypes ={
		count: React.PropTypes.number
	};

	static defaultProps ={
		count: 1
	};

	constructor(props, content, updater) {
		super(props, content, updater);
	}

	shouldComponentUpdate(props, state) {

		return true;
	}

	render() {
	  return (
	    <View style={this.props.myStyle}>

				<Text>总数: {this.props.count}</Text>
				<Text/>
				<Text onPress={_=>this.props.dispatch(Actions.add())}>加</Text>
	    </View>
	  );
	}
}

function mapStoreToProps({CountReducer}) {
	return {
		count: CountReducer.count
	};
};

export default connect(mapStoreToProps)(Main);